package com.chushouya.common.constant;

import com.general.framework.core.enums.IEnum;

/**
 * 评估扣减金额计算方式
 */
public enum EvaluateCalcTypeEnum implements IEnum<Integer> {

    amount(0, "按金额计算"),
    ratio(1, "按比例计算");

    private final Integer value;

    private final String desc;

    EvaluateCalcTypeEnum(Integer value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    @Override
    public Integer value() {
        return this.value;
    }

    @Override
    public String named() {
        return this.desc;
    }

    public static String getDesc(Integer value) {
        if (value == null) {
            return null;
        }
        for (EvaluateCalcTypeEnum type : values()) {
            if (value.equals(type.value)) {
                return type.desc;
            }
        }
        return "";
    }
}
